import java.util.Scanner;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class p1425 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int starMinutes = a*60 + b;
        int endMinutes = c*60 + d;
        int totalMinutes = endMinutes-starMinutes;
        int hours = totalMinutes /60;
        int minutes = totalMinutes % 60;
        System.out.println(hours + " "+minutes);
    }
}
